#include<bits/stdc++.h>
using namespace std;
const int maxn = 20;
int a[maxn][maxn];
static inline void show(int n) {
  for(int x=0; x<n; x++) {
    for(int y=0; y<n; y++) printf("%5d", a[x][y]);
    printf("\n");
  }
  printf("\n");
}
int main() {
  int n, x, y, tot=0;
  scanf("%d", &n);
  tot=a[x=0][y=n-1] = 1;
  while(tot < n*n) {
    // Check the subscirpt before accessing to avoid `out of bound`
    while(x+1<n && !a[x+1][y]) a[++x][y] = ++tot;
    show(n);
    while(y-1>=0 && !a[x][y-1]) a[x][--y] = ++tot;
    show(n);
    while(x-1>=0 && !a[x-1][y]) a[--x][y] = ++tot;
    show(n);
    while(y+1<n && !a[x][y+1]) a[x][++y] = ++tot;
    show(n);
  }
  show(n);
  return 0;
}
